/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx.controller;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ColumnListHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.SpringVersion;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.sql.SQLException;

/**
 * <p>Project: spmvcxml - IndexController
 * <p>Powered by webrx On 2022-03-22 16:36:52
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */

@Controller
public class IndexController {
    @Autowired
    QueryRunner run;
    @RequestMapping("/h3")
    public String h3(Model m) throws SQLException {
        m.addAttribute("version", SpringVersion.getVersion());
        m.addAttribute("dbs",run.query("show databases",new ColumnListHandler<>()));
        return "h3";
    }

}
